import axios from "axios";
import * as api from "../../api/gw/index.js";

export default function (params, success, fail) {
    console.log(api);
    let options = {
        method: "put",
        data: params,
        url: window.api.base_host + api.template_enable,
        headers: {sessionId: getCookie("sessionId")}
        // headers: {sessionId: "512ef7b0011540cfbee81cf4521c95e5"}
    }

    axios(options).then(data => {
        console.log("enable模板的返回值", data);
        if (data.status === 200 && data.data.returnCode === 1) {
            console.log("enable模板成功");
            success && success(data.data.data);
        } else {
            fail && fail(data.data.msg);
        }
    }).catch(err => {
        fail && fail();
    });

}